package com.jch.demo.cd.controller;

import com.jch.demo.cd.interceptor.Cross;
import com.jfinal.core.Controller;
import com.jfinal.log.Log;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 迩道
 */
public class AdminController extends Controller {

  static Log log = Log.getLog(AdminController.class);

  public void info(String token) {
    log.info(token);
    Map<String,Object> data = new HashMap<>();
    data.put("code",20000);
    Map<String, Object> map = new HashMap<>();
    map.put("name", "zhangsan");
    map.put("avatar", "http://5b0988e595225.cdn.sohucs.com/q_70,c_zoom,w_640/images/20180423/e58111e6b39b46b5bcfd54aa014e73c1.jpeg");
    map.put("roles", "[admin]");
    data.put("data",map);
    renderJson(data);
  }

  @Cross
  public void logout(){
    Map<String,Object> map = new HashMap<>();
    map.put("code",20000);
    renderJson(map);
  }


}
